﻿#include "../TVPlayer/TVPlayer.h"


#include "MainWindow.h"
#include "ui_MainWindow.h"


CMainWindow::CMainWindow(QWidget* parent /*= nullptr*/)
    : QMainWindow(parent)
    , m_ui(nullptr)
{
    init();
}

CMainWindow::~CMainWindow()
{

}

void CMainWindow::init()
{
    m_ui = new Ui::MainWindow();

    m_ui->setupUi(this);

    m_pTVPlayer = new TVPlayer(this);

    m_ui->gridLayout->addWidget(m_pTVPlayer, 0, 0);


    connect(m_ui->objPlay, SIGNAL(triggered(bool)), this, SLOT(slotPlay(bool)));
    connect(m_ui->objStop, SIGNAL(triggered(bool)), this, SLOT(slotStop(bool)));

}

void CMainWindow::slotPlay(bool checked /*= false*/)
{
    m_pTVPlayer->setUrl("rtmp://58.200.131.2:1935/livetv/cctv6");

    m_pTVPlayer->play();
}

void CMainWindow::slotStop(bool checked /*= false*/)
{
    m_pTVPlayer->stop();
}


